package com.ruoyi.business.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.business.domain.Comment;
import com.ruoyi.common.core.domain.entity.SysUser;
import io.swagger.annotations.ApiModel;
import lombok.Data;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * @author 最爱喝兽奶
 * @create 2022/7/30
 **/
@Data
@ApiModel("评论的视图对象")
public class CommentVo implements Serializable {

    private String id;

    private String parentId;

    private String courseId;

    private String commentUser;

    private SysUser commentUserVo;

    private Date commentTime;

    /**
     * 点赞数
     */
    private Long fabulous;

    /**
     * 评论内容
     */
    private String commentContext;

    /**
     * 踩的数量
     */
    private Long stamp;

    private Date createTime;

    private Date updateTime;

    /**
     * 二级评论
     */
    private List<Comment> children;

    public String getCommentTime() {
        if (null == this.commentTime) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        return sdf.format(this.commentTime);
    }
}
